<!--  -->
<template>
 
 {{ formData }}
  <el-card>
    <el-tabs
    v-model="activeName"
    type="card"
    class="demo-tabs"
  >

    <el-tab-pane label="基本信息" name="first">
    
      <ElderlyInfo></ElderlyInfo>
    </el-tab-pane>
    <el-tab-pane label="健康信息" name="second">
    
      <Nowillness></Nowillness>
      <Otherillness></Otherillness>
      <Selfcare></Selfcare>
      <Checkupitems></Checkupitems>
 
    </el-tab-pane>
    <el-tab-pane label="家属信息" name="third">
    
        <Family></Family>
     
    </el-tab-pane>
 
  </el-tabs>
  <el-button type="primary" @click="submit()">
    提交
      </el-button>
 
  </el-card>
</template>

<script lang='ts' setup>
import { reactive,toRefs,ref,onMounted, provide} from 'vue'
import { useRouter } from 'vue-router';
import { Elderly } from '../../apis/elderly/type';
const activeName = ref('first')
const router = useRouter();
const name=ref("");
import ElderlyInfo from '../../components/elderly/ElderlyInfo.vue';
import Nowillness from '../../components/elderly/Nowillness.vue';
import Otherillness from '../../components/elderly/Otherillness.vue';
import Selfcare from '../../components/elderly/Selfcare.vue';
import Checkupitems from '../../components/elderly/Checkupitems.vue';
import Family from '../../components/elderly/Family.vue';

const formData=reactive<Elderly>({
    name: "",
    mobile: "",
    photo: "",
    gender:1 ,
    birthday: "",//还有其它字段你们自己加上
    health:{
      oldillness: "",
        nowillness: "",
        otherillness: "",
        otherCase: ""
    },
    selfCares:[],
    checkups:[],
    family:[]
})

const getModel=()=>{
   //调接口 返回数据
   setTimeout(()=>{

    console.log("调接口返回数据");
    
     
  
   let data={
    "name": "Karry",
    "mobile": "",
    "photo": "upload/2024/5/27/20240527140509777.webp",
    "gender": 1,
    "birthday": "2024-05-21 09:09",
    "nativePlace": "河北省",
    "nation": "汉族",
    "idCard": "123456789012345678",
    "politics": "党员",
    "socialCard": "11111",
    "marriage": "已婚",
    "eduLevel": "能读写",
    "education": "博士",
    "resident": "11",
    "address": "111",
    "health": {
        "oldillness": "脑血管意外,心肌梗死",
        "nowillness": "脑血管意外,心肌梗死",
        "otherillness": "321313131231",
        "otherCase": "32131313"
    },
    "selfCares": [
        {
            "name": "进食",
            "val": "正常"
        },
        {
            "name": "修饰",
            "val": "轻度依赖"
        },
        {
            "name": "穿衣",
            "val": "正常"
        },
        {
            "name": "如厕、排泄",
            "val": "轻度依赖"
        },
        {
            "name": "移动",
            "val": "正常"
        }
    ],
    "checkups": [
        {
            "name": "肝功能+HbsAg",
            "picture": "upload/2025/4/28/20250428144105825.png"
        },
        {
            "name": "肝功能+HbsAg",
            "picture": "upload/2024/5/21/20240521091007413.jpg"
        },
        {
            "name": "血脂全套",
            "picture": "upload/2024/5/21/20240521091013674.png"
        },
        {
            "name": "血脂全套",
            "picture": "upload/2024/5/21/20240521091010339.jpg"
        }
    ],
    "family": [
        {
            "id": 1,
            "name": "aaaa",
            "mobile": "111",
            "idCard": "111",
            "relation": "母子",
            "gender": 1,
            "address": "11111111111"
        }
    ]
}

 Object.assign(formData,data);
},500)

}
//   getModel();
 

provide("formData",formData)

const submit=()=>{
  console.log(name.value);
  router.back();
}
</script>
<style scoped>
</style>